﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MpSoft.Library.DAO.Contents;
using MpSoft.Library.DTO;
using MpSoft.Basic.Configuration;

namespace MpSoft.Library.BUSS.Contents
{
    #region  GalleryLanguage
    
    public class GalleryLanguageBUSS
    {
        private const string GALLERYLANGUAGE_ALL_KEY = "Mp.gallerylanguage.all-{0}";
        private const string GALLERYLANGUAGE_BY_ID_KEY = "Mp.gallerylanguage.id-{0}";
        
        private static void GalleryLanguageRemoveCache()
        {
             MpCache.RemoveByPattern(GALLERYLANGUAGE_ALL_KEY);
             MpCache.RemoveByPattern(GALLERYLANGUAGE_BY_ID_KEY);
        }
        
        public static int GalleryLanguage_Add(GalleryLanguage obj)
        {
            var result = GalleryLanguageDAO.GalleryLanguage_Add(obj);
            return result;
        }
        public static int GalleryLanguage_Update(GalleryLanguage obj)
        {
            var result = GalleryLanguageDAO.GalleryLanguage_Update(obj);
            return result;
        }

        public static int GalleryLanguage_Delete(int GLID)
        {
            var result = GalleryLanguageDAO.GalleryLanguage_Delete(GLID);
            return result;
        }

        public static GalleryLanguage GalleryLanguage_ByID(int GLID)
        {
            var list = GalleryLanguage_Select(GLID, -1, null);
            if (list != null)
                return list.FirstOrDefault();
            return null;
        }

        public static GalleryLanguage GalleryLanguage_ByID(int GalleryID, string LanguageCode)
        {
            var list = GalleryLanguage_Select(-1, GalleryID, LanguageCode);
            if (list != null)
                return list.FirstOrDefault();
            return null;
        }

        public static List<GalleryLanguage> GalleryLanguage_Select(int GLID, int GalleryID, string LanguageCode)
        {
            return GalleryLanguageDAO.GalleryLanguage_Select(GLID, GalleryID, LanguageCode);
        }

    }
    
    #endregion
}

